package com.millstein.controller;


import com.millstein.service.BannerService;
import com.millstein.util.JsonData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author millstein
 * @since 2021-09-16
 */
@Api("轮播图控制器")
@RestController
@RequestMapping("/api/banner/v1")
public class BannerController {

    @Autowired
    private BannerService bannerService;

    @GetMapping("/page_banner")
    @ApiOperation("分页查询轮播图信息")
    public JsonData pageBanner(@ApiParam("当前页") @RequestParam(value = "page", defaultValue = "1") int page,
                               @ApiParam("每页记录数") @RequestParam(value = "size", defaultValue = "10") int size) {
        return JsonData.buildSuccess(bannerService.pageBanner(page, size));
    }
}

